<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'personList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  	<form name="form1" action="person_add.action" method="post">
  	<input type="hidden" name="selectNo"/>
  	<input type="hidden" name="updateName"/>
  	<table>
	    <tr><th>id</th><th>姓名</th><th>&nbsp;</th></tr>
	    <s:iterator value="#request.personList" id="item" status="st">
	    	<tr>
		    	<td><s:property value="#item.id"/></td>
		    	<td><input type="text" name="name<s:property value="#st.index"/>" value="<s:property value="#item.name"/>"/></td>
		    	<td>
		    		<input type="button" value="修改" onclick="form1.selectNo.value='<s:property value="#item.id"/>';
		    												  form1.updateName.value=form1.name<s:property value="#st.index"/>.value;
		    												  form1.action='person_update.action';
		    												  form1.submit();"/>
		    	</td>		    	
		    	<td>
		    		<input type="button" value="删除" onclick="form1.selectNo.value='<s:property value="#item.id"/>';
		    												  form1.action='person_delete.action';
		    												  form1.submit();"/>
		    	</td>
	    	</tr>
	    </s:iterator>
    </table>
    <br/>
    姓名：<input type="text" name="person.name"/>
    <input type="button" value="添加" onclick="form1.action='person_add.action';
		    												  form1.submit();"/>
    <s:debug/>
    </form>
  </body>
</html>
